package com.axxc.jpa.filter;

import java.util.Arrays;
import java.util.Map;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName: WebListener
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author xxc
 * @date 2018年9月20日 上午9:12:45
 * @see {@link https://gitee.com/biuabiu }
 */
@WebListener
public class WebRequestListener implements ServletRequestListener {

	@Override
	public void requestDestroyed(ServletRequestEvent sre) {
		System.out.println("WebRequestListener 销毁");
	}

	@Override
	public void requestInitialized(ServletRequestEvent sre) {
		System.out.println("WebRequestListener 初始化");
		HttpServletRequest request = (HttpServletRequest) sre.getServletRequest();
		Map<String, String[]> map = request.getParameterMap();

		map.forEach((K, V) -> {
			System.out.println(K);
			System.out.println(Arrays.toString(V));
		});
	}

}
